VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmBasicGLJE 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   7290
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   13545
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   7290
   ScaleWidth      =   13545
   ShowInTaskbar   =   0   'False
   Begin ITGControls.ComunionFrames Frame2 
      Height          =   3570
      Left            =   30
      Top             =   3075
      Width           =   12615
      _ExtentX        =   22251
      _ExtentY        =   6297
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Details"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin MSDataGridLib.DataGrid dtgJE 
         Height          =   2580
         Left            =   0
         TabIndex        =   9
         Top             =   420
         Width           =   12615
         _ExtentX        =   22251
         _ExtentY        =   4551
         _Version        =   393216
         AllowUpdate     =   -1  'True
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         FormatLocked    =   -1  'True
         AllowDelete     =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   7
         BeginProperty Column00 
            DataField       =   "cAcctNo"
            Caption         =   "Account No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "0%"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cTitle"
            Caption         =   "Title"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cRemarks"
            Caption         =   "Remarks"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "nDebit"
            Caption         =   "Debit"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "nCredit"
            Caption         =   "Credit"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "cCLRDNo"
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column06 
            DataField       =   "cPCcode"
            Caption         =   "Profit Center"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               Button          =   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1349.858
            EndProperty
            BeginProperty Column01 
               ColumnWidth     =   2775.118
            EndProperty
            BeginProperty Column02 
               ColumnWidth     =   3374.929
            EndProperty
            BeginProperty Column03 
               Alignment       =   1
            EndProperty
            BeginProperty Column04 
               Alignment       =   1
            EndProperty
            BeginProperty Column05 
               Object.Visible         =   0   'False
            EndProperty
            BeginProperty Column06 
               Button          =   -1  'True
               Locked          =   -1  'True
            EndProperty
         EndProperty
      End
      Begin ITGControls.ITGTextBox txtCredit 
         Height          =   285
         Left            =   9375
         TabIndex        =   16
         Top             =   3165
         Width           =   1530
         _ExtentX        =   2593
         _ExtentY        =   503
         BackColor       =   14737632
         LabelBackColor  =   16243138
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Text            =   "0"
         DataType        =   1
         Mandatory       =   -1  'True
         DecimalPlace    =   2
         Label           =   ""
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   0
         TextBoxWidth    =   1470
         Enabled         =   0   'False
         LinkForeColor   =   0
      End
      Begin ITGControls.ITGTextBox txtDebit 
         Height          =   285
         Left            =   6540
         TabIndex        =   17
         Top             =   3165
         Width           =   2730
         _ExtentX        =   4604
         _ExtentY        =   503
         BackColor       =   14737632
         LabelBackColor  =   16243138
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Text            =   "0"
         DataType        =   1
         DecimalPlace    =   2
         Label           =   "Total"
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   1250
         TextBoxWidth    =   1420
         Enabled         =   0   'False
         LinkForeColor   =   0
      End
   End
   Begin ITGControls.ITGTab SSTab1 
      Height          =   3180
      Left            =   30
      TabIndex        =   10
      Top             =   30
      Width           =   12615
      _ExtentX        =   22251
      _ExtentY        =   5609
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "Frame1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      InActiveTabForeColor=   -2147483639
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483627
      Begin ITGControls.ComunionFrames Frame1 
         Height          =   2865
         Left            =   0
         Top             =   315
         Width           =   12615
         _ExtentX        =   22251
         _ExtentY        =   5054
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Journal Voucher Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.CommandButton cmdPickWork 
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   2650
            Picture         =   "frmBasicGLJE.frx":0000
            Style           =   1  'Graphical
            TabIndex        =   22
            Top             =   1650
            Width           =   300
         End
         Begin VB.CommandButton cmdPickProject 
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   2650
            Picture         =   "frmBasicGLJE.frx":014A
            Style           =   1  'Graphical
            TabIndex        =   19
            Top             =   1350
            Width           =   300
         End
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   3090
            Top             =   435
         End
         Begin VB.ComboBox cboType 
            Height          =   315
            ItemData        =   "frmBasicGLJE.frx":0294
            Left            =   7065
            List            =   "frmBasicGLJE.frx":0296
            Sorted          =   -1  'True
            Style           =   2  'Dropdown List
            TabIndex        =   2
            Top             =   705
            Width           =   1395
         End
         Begin VB.CommandButton cmdPickCode 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   2640
            Picture         =   "frmBasicGLJE.frx":0298
            Style           =   1  'Graphical
            TabIndex        =   4
            Top             =   1050
            Width           =   315
         End
         Begin VB.CommandButton cmdPickRefID 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   2640
            Picture         =   "frmBasicGLJE.frx":03E2
            Style           =   1  'Graphical
            TabIndex        =   7
            Top             =   1950
            Width           =   315
         End
         Begin ITGControls.ITGTextBox txtRemarks 
            Height          =   285
            Left            =   165
            TabIndex        =   8
            Top             =   2265
            Width           =   6945
            _ExtentX        =   12039
            _ExtentY        =   503
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Remarks"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   5635
            Required        =   -1  'True
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGDateBox dtbDate 
            Height          =   285
            Left            =   4845
            TabIndex        =   1
            Top             =   735
            Width           =   1395
            _ExtentX        =   2461
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtTranNo 
            Height          =   285
            Left            =   165
            TabIndex        =   0
            Top             =   735
            Width           =   2460
            _ExtentX        =   4128
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Entry No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1150
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtName 
            Height          =   285
            Left            =   2955
            TabIndex        =   5
            Top             =   1050
            Width           =   4155
            _ExtentX        =   7223
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   4095
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtCode 
            Height          =   285
            Left            =   165
            TabIndex        =   3
            Top             =   1050
            Width           =   2445
            _ExtentX        =   4101
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Supplier"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1135
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtRefID 
            Height          =   285
            Left            =   165
            TabIndex        =   6
            Top             =   1950
            Width           =   2445
            _ExtentX        =   4101
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Reference ID"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1135
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtType 
            Height          =   285
            Left            =   7065
            TabIndex        =   15
            Top             =   750
            Width           =   1065
            _ExtentX        =   1773
            _ExtentY        =   503
            BackColor       =   14745599
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   ""
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1005
            Enabled         =   0   'False
         End
         Begin ITGControls.ComunionLabel lblCodeDesc 
            Height          =   315
            Left            =   8610
            TabIndex        =   18
            Top             =   705
            Width           =   2310
            _ExtentX        =   4075
            _ExtentY        =   556
            BackColor       =   16777215
            Caption         =   ""
            Enabled         =   -1  'True
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   0
         End
         Begin ITGControls.ITGTextBox txtProjectName 
            Height          =   285
            Left            =   2955
            TabIndex        =   20
            TabStop         =   0   'False
            Top             =   1350
            Width           =   4155
            _ExtentX        =   7223
            _ExtentY        =   503
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Locked          =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   4095
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtProject 
            Height          =   285
            Left            =   165
            TabIndex        =   21
            Top             =   1350
            Width           =   2445
            _ExtentX        =   4101
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Project"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1135
            Required        =   -1  'True
            LinkForeColor   =   16711680
         End
         Begin ITGControls.ITGTextBox txtWorkDesc 
            Height          =   285
            Left            =   2955
            TabIndex        =   23
            TabStop         =   0   'False
            Top             =   1650
            Width           =   4155
            _ExtentX        =   7223
            _ExtentY        =   503
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   4095
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtWork 
            Height          =   285
            Left            =   165
            TabIndex        =   24
            Top             =   1650
            Width           =   2445
            _ExtentX        =   4101
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Work"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1135
            Required        =   -1  'True
            LinkForeColor   =   16711680
         End
         Begin VB.Label Label5 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date"
            Height          =   195
            Left            =   4410
            TabIndex        =   13
            Top             =   780
            Width           =   345
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Code"
            Height          =   195
            Left            =   6645
            TabIndex        =   12
            Top             =   765
            Width           =   375
         End
      End
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   2655
         Left            =   -75000
         TabIndex        =   11
         Top             =   315
         Width           =   12615
         _ExtentX        =   22251
         _ExtentY        =   4683
         _Version        =   393216
         AllowUpdate     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   6
         BeginProperty Column00 
            DataField       =   "cCompanyID"
            Caption         =   "Company ID"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cTranNo"
            Caption         =   "Transaction No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cCode"
            Caption         =   "Code"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "dDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "lPosted"
            Caption         =   "Posted"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "lClosed"
            Caption         =   "Closed"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               Locked          =   -1  'True
               ColumnWidth     =   1649.764
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   2204.788
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
               ColumnWidth     =   2039.811
            EndProperty
            BeginProperty Column03 
               Locked          =   -1  'True
               ColumnWidth     =   1814.74
            EndProperty
            BeginProperty Column04 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column05 
               Locked          =   -1  'True
            EndProperty
         EndProperty
      End
   End
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   14
      Top             =   7005
      Width           =   13545
      _ExtentX        =   23892
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   10665
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
End
Attribute VB_Name = "frmBasicGLJE"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private AutoNum As New clsAutoNumber '---Added
Public MenuName As String '---Added

'Object variables
Private oPrint As New clsPrinting

Private connHeader As ADODB.Connection
Private connDetail As ADODB.Connection
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsDetail As ADODB.Recordset

Enum eBasicJEMode
    Normal
    AddNewEdit
    Find
End Enum

Public Mode As eBasicJEMode
Public dtgName As String
Public sBit As String
Private vBM As Variant
Private lSystemGenerated As Boolean
Public strNo As String
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean
Private lSysTransDate As Boolean 'add by denz:2/17/2011 for transdate

Private Sub cboType_Click()
If Mode = AddNewEdit Then
    txtType = Trim(cboType)
    txtName.Text = ""
    txtCode.Text = ""
    txtRefID.Text = ""
    If txtType = "JE" Then
        Me.lblCodeDesc.Caption = "             Journal Entry          "
        txtRefID.Enabled = False
        cmdPickRefID.Enabled = False
        txtCode.Enabled = False
        cmdPickCode.Enabled = False
        txtName.Enabled = False
    ElseIf txtType = "JV" Then
        Me.lblCodeDesc.Caption = "            Journal Voucher         "
        txtCode.Enabled = True
        cmdPickCode.Enabled = True
        txtRefID.Enabled = False
        cmdPickRefID.Enabled = False
        Me.txtCode.Label = "Client/Supplier"
        
    ElseIf txtType = "LOE" Then
        Me.lblCodeDesc.Caption = "              Liquidation           "
        txtCode.Enabled = True
        cmdPickCode.Enabled = True
        txtRefID.Enabled = True
        cmdPickRefID.Enabled = True
        Me.txtCode.Label = "Employee"
    ElseIf txtType = "PAY" Then
        Me.lblCodeDesc.Caption = "             Payable Setup          "
        txtCode.Enabled = True
        cmdPickCode.Enabled = True
        txtRefID.Enabled = True
        cmdPickRefID.Enabled = True
        Me.txtCode.Label = "Supplier"
    Else
        Me.lblCodeDesc.Caption = ""
    End If
End If
End Sub

Private Sub cboType_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
    If rsDetail.RecordCount = 0 Then TBNewLine
End Sub

Private Sub cmdPickCode_Click()
    If Trim(cboType) = "" Then
        MsgBox "Please select a type", vbInformation
        Exit Sub
    End If
    If lPickListActive Then Exit Sub
    If txtType.Text = "LOE" Then
        frmITGPicker.zType = QEmployee
        
    ElseIf txtType.Text = "JV" Then
        frmITGPicker.zType = Qclientsupplierall
    ElseIf txtType.Text = "PAY" Then
        frmITGPicker.zType = Qsupplierall
    Else
        frmITGPicker.zType = QSupplierNT
    End If

'    If lPickListActive Then Exit Sub
'    frmITGPicker.zType = QSupplier
    'added condition
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
    
    frmITGPicker.Show vbModal
    txtCode = frmITGPicker.zCode
    txtName = frmITGPicker.zName
    
    frmITGPicker.zCode = ""
    frmITGPicker.zName = ""
    
    If Trim(txtName) <> "" Then
        SendKeys "{Tab}"
    End If
    
End Sub

Private Sub cmdPickRefID_Click()
If Trim(txtCode) = "" Then
        MsgBox "Please select supplier first.", vbExclamation, msgTtl
        txtCode.SetFocus
        Exit Sub
End If

If Mode <> AddNewEdit Then Exit Sub
    If cboType = "LOE" Then
        RepName = Trim(txtCode)
        frmPMSLister.mPMSPick = ToJV
        frmPMSLister.Show vbModal
        txtRefID = vStrContainer1
    ElseIf cboType = "PAY" Then
        RepName = Trim(txtCode)
        frmPMSLister.mPMSPick = ToPayable
        frmPMSLister.Show vbModal
        txtRefID = vStrContainer1
    End If

'    If lPickListActive Then Exit Sub
'    frmITGPicker.zType = QPayables
'    'added condition
'    frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
'    frmITGPicker.Show vbModal
'    txtRefID = frmITGPicker.zCode
'
    
    If Trim(txtName) <> "" Then
        SendKeys "{Tab}"
    End If
    
End Sub

Private Sub dtgJE_Click()
    If Mode = AddNewEdit Then dtgName = dtgJE.Name
End Sub

Private Sub dtgJE_GotFocus()
    dtgName = dtgJE.Name
End Sub

Private Sub dtgJE_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

Private Sub Form_Load()

    Set FrmName = Me
    FormSetup

    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'BGL01'")
    
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset

    sSQL = "(SELECT module_id FROM erp_sec_modules WHERE link = '" & Me.Name & "')"
    
    Call LoadComboValues(cboType, "RefType", "ComboValueSetUp", "Where RefModule = " & sSQL & " AND Visible = 1 and cCompanyID = '" & Trim(COID) & "'")

    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    
    Mode = Find
    txtTranNo.Locked = False
    
End Sub

Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        If MsgBox("Do you want to save changes before closing?", vbYesNo, Me.Caption) = vbYes Then
            TBSave
        Else
            TBUndoCurrent
        End If
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
  
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set connHeader = Nothing
    Set connDetail = Nothing
    Set frmBasicGLJE = Nothing
    lCloseWindow = True
    
    'oForm(Me.Tag).Mode = 1
    'oForm(Me.Tag).Tag = Me.Tag
End Sub

Public Sub TBNew()
On Error GoTo ErrorHandler
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtTranNo.BackColor = &HE0FFFF
    Mode = AddNewEdit
    
    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenNewConnection connDetail
        OpenRecordsetWithCN rsDetail, "*", "GL_T", connDetail, "WHERE 1 = 0"
        OpenRecordsetWithCN rsHeader, "*", "GL", connHeader, "WHERE 1 = 0"
        SetDataSource
        SetDataField
    Else
        vBM = rsHeader.Bookmark
    End If
    
    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!dDate = Date
    rsHeader!cCode = "JE"
    
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    SSTab1.ActiveTab = 0
    txtTranNo.SetFocus
    txtTranNo.Locked = True
    
    
    MenuName = "AUTO_NUMBER_JE"
    lSystemGenerated = GetValueFrTable("lAutoNo", "system_autonumber", "cCode = '" & MenuName & "' ")
    If lSystemGenerated Then rsHeader!cTranNo = AutoNum.Generate_CtrlNo2(MenuName, Format(Now, "mm/dd/yyyy"))
    
    strNo = rsHeader!cTranNo
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Public Sub TBUndoAll()
On Error Resume Next
        
    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    rsDetail.CancelBatch adAffectAll

    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
    Else
        RSZero
        Mode = Find
    End If

    sbRS.Panels(2) = ""
    
    SetDataSource
    SetDataField

ErrorHandler:

    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoAll
    End If
End Sub

Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    GetChild
    If rsHeader.Status = adRecNew Then
        rsDetail.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsDetail.CancelBatch adAffectAll
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then
        TBUndoCurrent
    End If

End Sub

Public Sub TBSave()
On Error GoTo ErrHandler
Dim OKUpdate As Boolean

    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True

    If Not MandatoryOK Then Exit Sub
    
    If rsHeader.Status = adRecNew Then

        If lSystemGenerated Then
            'If ChkCtrlNo(rsHeader, "AUTO_NUMBER_JE", "GL", "cTranNo", rsHeader!cTranNo) <> rsHeader!cTranNo Then
            If AutoNum.Check_CtrlNo2(rsHeader, "GL", "cTranNo", rsHeader!cTranNo, MenuName, rsHeader!dDate) <> rsHeader!cTranNo Then
                
                GetChild
                
                rsHeader!cTranNo = strNo
                
                If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
                Do Until rsDetail.EOF
                    rsDetail!cTranNo = strNo
                    rsDetail.MoveNext
                Loop
                
                GetChild
            End If
        End If
    End If
    
    OKUpdate = False
    
    cn.BeginTrans
    connHeader.BeginTrans
    connDetail.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
    rsDetail.UpdateBatch adAffectAll
    
    cn.CommitTrans
    connHeader.CommitTrans
    connDetail.CommitTrans
    OKUpdate = True
    
    'Update GL Activity
    UpdateGLA "Update", "GL", Trim(txtTranNo)
                    
    
    Set FrmName = Me
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, lACPrint, True
    Mode = Normal
    
    UpdateLogFile "Journal Entry", Trim(txtTranNo), IIf(lBoolean, "Inserted", "Updated")

    If lBoolean Then
        If lSystemGenerated And strNo = rsHeader!cTranNo Then
            UpdateControlNo strNo, rsHeader!cTranNo, "AUTO_NUMBER_JE"
            AutoNum.Update_CtrlNo2 strNo, MenuName, Format(Now, "mm/dd/yyyy")
        End If
    End If
    
    If lBoolean = False Then ' Edit
            cn.Execute ("UPDATE GL SET  dUpdated = GETDATE() WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    Else ' Insert
            cn.Execute ("UPDATE GL SET  dUpdated = GETDATE() WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    End If
   
    MsgBox "Record/s successfully saved.", vbInformation, msgTtl
    sbRS.Panels(2) = ""
    
ErrHandler:
'MsgBox err.Description
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, msgTtl
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsDetail.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, lACPrint, True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, msgTtl
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name 'Error log
    End If
End Sub

Public Sub TBEdit()
On Error GoTo ErrorHandler
    If rsHeader!lClosed = True Then
        MsgBox "Transaction already CLOSED. Transaction cannot be Edited. ", vbInformation, "iTGroup Inc."
        Exit Sub
    ElseIf rsHeader!lPosted = True Then
        MsgBox "Transaction already POSTED. Transaction cannot be Edited. ", vbInformation, "iTGroup Inc."
        Exit Sub
    Else
        Mode = AddNewEdit
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
        Set FrmName = Me
        FormLocking False
        ClrRequired &HC0&
        txtTranNo.Locked = True
        SSTab1.ActiveTab = 0
        dtbDate.SetFocus
        vBM = rsHeader.Bookmark
        
        MenuName = "AUTO_NUMBER_JE"
        lSysTransDate = GetValueFrTable("lTransDate", "system_autonumber", "cCode = '" & MenuName & "' ") 'add by denz:2/17/2011
        If lSysTransDate Then
            dtbDate.Enabled = True
        Else: dtbDate.Enabled = False
        End If
    End If
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Public Sub TBDelete()
On Error GoTo ErrorHandler
    
    If rsHeader!lClosed = True Then
        MsgBox "Transaction already CLOSED. Transaction cannot be DELETED. ", vbInformation, "iTGroup Inc."
        Exit Sub
    ElseIf rsHeader!lPosted = True Then
        MsgBox "Transaction already POSTED. Transaction cannot be DELETED. ", vbInformation, "iTGroup Inc."
        Exit Sub
    End If
    
    Mode = Normal
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, lACPrint, True
    
    sID = Trim(txtTranNo)
    
    If rsHeader.RecordCount = 0 Then Exit Sub
    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub
    GetChild
    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.RecordCount = 0
            rsDetail.Delete adAffectCurrent
            If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
        Loop
    End If

    rsHeader.Delete adAffectCurrent
    
    rsDetail.UpdateBatch adAffectAll
    rsHeader.UpdateBatch adAffectAll
    

    UpdateGLA "Delete", "GL", Trim(Me.txtTranNo)
    TBPrevRec
    
    Mode = Normal
    
    UpdateLogFile "Journal Entry", Trim(txtTranNo), "Deleted"
    If rsHeader.RecordCount = 0 Then
        RSZero
    End If
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        cn.Execute "DELETE GL_T WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE GL WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
    End If
End Sub


Public Sub TBFind()
    Mode = Normal
    txtTranNo.Locked = True
    txtType.Text = ""
    frmITGSearch.Show
End Sub

Public Sub TBFindPrimary()
On Error GoTo ErrorHandler
Dim sTemp As String
If Mode = Find Then
    FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
            
    OpenNewConnection connHeader
    OpenNewConnection connDetail
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset
                
    sTemp = Trim$(GetSearchString)
    If sTemp = "ERROR" Then
        MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
        txtTranNo.Locked = False
        txtTranNo.SetFocus
        Exit Sub
    End If
             
    OpenRecordsetWithCN rsHeader, "*", "GL", connHeader, IIf(sTemp = "", "", " WHERE " & sTemp)
    OpenRecordsetWithCN rsDetail, "*", "GL_T", connDetail, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM GL WHERE " & sTemp & ")")
     
    Set FrmName = Me
    FormLocking True

     If rsHeader.RecordCount = 0 Then
        FormWaitHide
        MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
        Exit Sub
    End If
    SetDataSource
    SetDataField
    txtTranNo.BackColor = &HE0FFFF
    
    
    Mode = Normal
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, lACPrint, True, True

    FormWaitHide
Else
    RSZero
    FormSearch True
    SearchObj True
    Mode = Find

End If
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
    dtgName = dtgJE.Name
End Sub

Public Sub TBCloseWindow()
    Unload Me
End Sub

Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader

End Sub

Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader

End Sub

Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader

End Sub

Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader

End Sub


Public Sub TBNewLine()
On Error GoTo ErrorHandler

    If rsHeader!cTranNo = "" Then Exit Sub
    
    If dtgName = "dtgJE" Then
        rsDetail.AddNew
        rsDetail!cCompanyID = COID
        rsDetail!cTranNo = Trim(rsHeader!cTranNo)
        GetChild
        If rsDetail.RecordCount <> 0 Then rsDetail.MoveLast

    End If
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Public Sub TBDeleteLine()
On Error GoTo ErrorHandler

    If dtgName = dtgJE.Name Then
        If rsDetail.RecordCount = 0 Then Exit Sub
        vBookMark = dtgJE.Bookmark
        GetChild
        dtgJE.Bookmark = vBookMark
        rsDetail.Delete adAffectCurrent
    End If
    GetChild

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBPostRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBCancelRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBPrintRecord()
'    MsgBox "Unavailable on " & Me.Name
    If Trim(txtTranNo) = "" Then Exit Sub
    RepName = "Journal_Entry_Trans"
    cModule = "Basic_Journal_Entry"
    ORnum = txtTranNo.Text
    oPrint.PrintReceipt Trim(txtTranNo)

End Sub

Private Sub RSZero()
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    sbRS.Panels(4) = ""
    sbRS.Panels(5) = ""
    
    Set dtgJE.DataSource = Nothing
    dtgJE.Refresh
    
    Set FrmName = Me
    
    UnbindControls
    TextClearing
    FormLocking True
    
    If rsHeader.State = adStateOpen Then rsHeader.Close
    If rsDetail.State = adStateOpen Then rsDetail.Close
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
    txtTranNo.Locked = False
    txtTranNo.SetFocus
    
    Mode = Find
    
End Sub

Sub SearchObj(lEnable As Boolean)
    dtbDate.Enabled = lEnable
    cboType.Enabled = lEnable
    cmdPickProject.Enabled = lEnable
    cmdPickWork.Enabled = lEnable
End Sub

Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgList.DataSource = rsHeader
    Set dtgJE.DataSource = rsDetail
    
End Sub

Public Sub SetDataField()
On Error GoTo ErrorHandler
    With rsHeader
        txtTranNo.DataField = !cTranNo
        txtType.DataField = !cCode
        txtProject.DataField = !cProjectID
        dtbDate.DataField = !dDate
        txtDebit.DataField = !nDebit
        txtCredit.DataField = !nCredit
        txtCode.DataField = !cSCode
        txtRemarks.DataField = !cRemarks
        txtRefID.DataField = !cRefNo
        txtWork.DataField = !cWorkID
    End With
    'Exit Sub
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub


Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler

    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        'Status bar setup
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount

        If rsHeader.Status <> adRecNew Then
            txtTranNo.Locked = True
        Else
            txtTranNo.Locked = False
        End If

        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else
            sbRS.Panels(2) = ""
        End If
        
        GetChild
        
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtTranNo.Locked = False
    End If

    If Mode = AddNewEdit Then
        dtgJE.Refresh
    End If

ErrorHandler:
    
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Private Sub dtgJE_AfterColUpdate(ByVal ColIndex As Integer)
On Error GoTo ErrorHandler
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            If GetValueFrTable("cAcctNo", "ACCOUNT", "cAcctNo = '" & Trim(dtgJE.Columns(0).Text) & "' ") <> "" Then
                GetInitialItemValues rsDetail
                dtgJE.Col = 2
                dtgJE.Columns(2).Value = ""
            End If
        Case 3, 4
            ComputeTotal
    End Select
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub dtgJE_ButtonClick(ByVal ColIndex As Integer)
On Error GoTo ErrorHandler
    Select Case ColIndex
        Case 0
            If lPickListActive Then Exit Sub
            sFilterString = Trim(dtgJE.Columns(0).Text)
            frmITGPicker.zType = QAccounts
            'added condition
            frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
            
            frmITGPicker.Show vbModal
            If Trim(frmITGPicker.zCode) = "" Then Exit Sub
            rsDetail!cAcctNo = Trim(frmITGPicker.zCode) & ""
            If (Trim(frmITGPicker.zName) & "") <> "" Then
                GetInitialItemValues rsDetail
                dtgJE.Col = 2
                dtgJE.Columns(2).Value = ""
            End If
        Case 6
            If lPickListActive Then Exit Sub
            frmITGPicker.zType = QProfitCenter
            'added condition
            frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
            frmITGPicker.Show vbModal
            dtgJE.Columns(6).Value = frmITGPicker.zCode
        
    End Select
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub dtgJE_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgJE_KeyPress(KeyAscii As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then Exit Sub
    
    If KeyAscii = 39 Then KeyAscii = 0
    
    If KeyAscii = 13 Then
        Select Case dtgJE.Col
            Case 0
                If GetValueFrTable("cAcctNo", "ACCOUNT", "cAcctNo = '" & Trim(dtgJE.Columns(0).Text) & "'") = "" Then
                    dtgJE_ButtonClick (0)
                End If
            Case 4
                TBNewLine
                dtgJE.Col = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        
    End If
End Sub

Private Sub dtgJE_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgJE.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub txtCode_Change()
    txtName = ""
    txtName = GetValueFrTable("cName", "CLIENT_SUPPLIER", "cCode = '" & Trim(txtCode) & "'")
End Sub




Private Sub txtTranNo_LostFocus()
        If Mode = AddNewEdit Then
        If Trim(txtTranNo) = "" Then
            MsgBox "Empty primary input.", vbInformation, msgTtl
            If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
            txtTranNo.SetFocus
        Else
            If rsHeader.Status <> adRecNew Then Exit Sub
            txtTranNo = Trim(txtTranNo)
            If IDExisting(rsHeader, "cTranNo", "GL", Trim(rsHeader!cTranNo)) Then
                MsgBox "Transaction No. already exist.", vbInformation, msgTtl
                If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
                txtTranNo.SetFocus
            End If
        End If
    End If
End Sub

Function MandatoryOK() As Boolean

    MandatoryOK = True

    If Trim(txtTranNo) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction number' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtTranNo.SetFocus
        Exit Function
    End If
        
    If rsHeader.Status = adRecNew And lSystemGenerated = False Then
        If IDExisting(rsHeader, "cTranNo", "GL", Trim(rsHeader!cTranNo)) Then
            MandatoryOK = False
            MsgBox "Transaction No. already exist.", vbInformation, msgTtl
            txtTranNo.SetFocus
            Exit Function
        End If
    End If

    If Trim(dtbDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        dtbDate.SetFocus
        Exit Function
    ElseIf Trim(cboType) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Code' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        cboType.SetFocus
        Exit Function
    End If
    
    GetChild

    If rsDetail.RecordCount < 1 Then
        MandatoryOK = False
        MsgBox "Cannot save transaction without details.", vbInformation, msgTtl
        dtgJE.SetFocus
        Exit Function
    End If
    
    
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
    Do Until rsDetail.EOF
    
        'code by gino: To validate the quantity of the product
        If rsHeader!cCode <> "JE" Then
            If IsNull(rsDetail!cPCCode) Then
                    MandatoryOK = False
                    MsgBox "Profit Center' is mandatory. Null value is not allowed.", vbInformation, msgTtl
                    dtgJE.SetFocus
                    Exit Function
            End If
        End If
    
        If rsDetail.Status = (adRecNew) Or rsDetail.Status = (adRecModified) Then
            If IsNull(rsDetail!cAcctNo) Then
                rsDetail.Delete
            ElseIf Trim(rsDetail!cAcctNo) = "" Then
                rsDetail.Delete
            Else
                rsDetail.MoveNext
            End If
        Else
            rsDetail.MoveNext
        End If
    Loop
    
    ComputeTotal
    If rsHeader!nDebit <> rsHeader!nCredit Then
        MsgBox "Cannot save unbalance transaction.", vbExclamation, msgTtl
        MandatoryOK = False
        Exit Function
    End If
    
    GetChild

    If rsDetail.RecordCount < 1 Then
        MsgBox "Cannot save transaction without details.", vbExclamation, msgTtl
        MandatoryOK = False
        Exit Function
    End If

    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.EOF
            rsDetail!nIdentity = rsDetail.AbsolutePosition
            rsDetail.MoveNext
        Loop
    End If
    GetChild
    
End Function


Private Sub GetChild()
    rsDetail.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab1.TabEnabled(1) = False
    Else
        SSTab1.TabEnabled(1) = True
    End If
End Sub

Private Sub GetInitialItemValues(RefRS As Recordset)
    RefRS!cTitle = Trim(GetValueFrTable("cTitle", "ACCOUNT", "cAcctNo = '" & Trim(RefRS!cAcctNo) & "'")) & ""
    RefRS!nDebit = 0
    RefRS!nCredit = 0
End Sub

Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtTranNo.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cTranNo LIKE '" & Trim$(txtTranNo.Text) & "%'"
    End If

    If Trim$(dtbDate.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dDate = '" & Trim$(dtbDate.Text) & "'"
    End If
    
    If Trim$(txtType.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cCode LIKE '" & Trim$(txtType.Text) & "%'"
    End If
    
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

Sub ComputeTotal()
Dim nDebit, nCredit As Double
On Error Resume Next

    If Mode <> AddNewEdit Then Exit Sub

    nDebit = 0
    nCredit = 0
    Set rs = New Recordset
    Set rs = rsDetail.Clone
    rs.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"

    rs.MoveFirst
    Do Until rs.EOF
        nDebit = nDebit + IIf(IsNull(rs!nDebit) Or Trim(rs!nDebit) = "", 0, rs!nDebit)
        nCredit = nCredit + IIf(IsNull(rs!nCredit) Or Trim(rs!nCredit) = "", 0, rs!nCredit)
        rs.MoveNext
    Loop
    Set rs = Nothing
    
    rsHeader!nDebit = nDebit
    rsHeader!nCredit = nCredit
End Sub

Private Sub txtType_Change()
     If Trim(txtType) <> "" Or txtType <> vbNullString Then
        cboType = Trim(txtType)
    Else
        cboType.ListIndex = -1
    End If
End Sub

Public Sub ShowForm(sTranNo As String)
    If Mode = Find Then

        OpenNewConnection connHeader
        OpenNewConnection connDetail

        Set rsHeader = Nothing
        Set rsDetail = Nothing
        Set rsHeader = New ADODB.Recordset
        Set rsDetail = New ADODB.Recordset

        OpenRecordsetWithCN rsDetail, "*", "GL_T", connDetail, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
        OpenRecordsetWithCN rsHeader, "*", "GL", connHeader, "WHERE cTranNo = '" & Trim(sTranNo) & "'"

        Set FrmName = Me
        FormLocking True

        If rsHeader.RecordCount = 0 Then
            FormWaitHide
            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
            RSZero
            FormSearch True
            SearchObj True
            Mode = Find
            Exit Sub
        End If
            SetDataSource
            SetDataField
            txtTranNo.BackColor = &HE0FFFF
            Mode = Normal
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True, True

            'BitEnabled Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True, True

    End If
End Sub
'------------------------------------------------------------------------------------------------------------
'Public Sub AddDetailsFromExpenses(InvNo As String, InvDate As String, InvBalance As Double)
'
'    'txtRefID = InvNo
'
'    GetChild
'    If rsDetail.RecordCount <> 0 Then
'        rsDetail.MoveFirst
'        Do Until rsDetail.RecordCount = 0
'            rsDetail.Delete adAffectCurrent
'            If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
'        Loop
'    End If
'
'    sSQL = "SELECT * FROM PMS_EXPENSE_T WHERE cCompanyID = '" & COID & "' AND cTranNo = '" & Trim(InvNo) & "'"
'    Set rs = New Recordset
'    rs.Open sSQL, cn, adOpenForwardOnly, adLockReadOnly
'
'    Do While Not rs.EOF
'        With rsDetail
'            .AddNew
'            !cCompanyID = COID
'            !cTranNo = rsHeader!cTranNo
'            !cTranType = rs!cType
'            !cExpType = rs!cType
'            !cProjectID = rs!cProjectID
'            !cRemarks = rs!cDesc
'            !cAcctNo = rs!cAcctNo
'            !cTitle = GetValueFrTable("cTitle", "ACCOUNT", "cAcctNo = '" & Trim(rs!cAcctNo) & "'")
'            '!nDebit = rs!nAmount
'            !nCredit = 0
'            !nRefIdentity = rs!nIdentity
'            !cCLRDNo = rs!cTranNo
'            !cRefCode = rs!cCode
'            !cRefVAT = rs!Cvat
'            !cRefNo = rs!cRefNo
'            !dRefDate = rs!dDate
'            If !cRefVAT = "Yes" Then
'                !nDebit = Round((rs!nAmount / getTax), 2)
'                .AddNew
'                !cTranNo = rsHeader!cTranNo
'                !cCompanyID = COID
'                !cTranType = rs!cType
'                !cExpType = rs!cType
'                !cProjectID = "1965-001-0000"
'                !cRemarks = rs!cDesc
'                !cAcctNo = GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'DEF_WTAX1'")
'                !cTitle = GetValueFrTable("cTitle", "ACCOUNT", "cAcctNo = '" & Trim(!cAcctNo) & "'")
'                !nDebit = Round(rs!nAmount - (rs!nAmount / getTax), 2)
'                !nCredit = 0
'                !nRefIdentity = rs!nIdentity
'                !cCLRDNo = rs!cTranNo
'                !cRefCode = rs!cCode
'                !cRefVAT = rs!Cvat
'                !cRefNo = rs!cRefNo
'                !dRefDate = rs!dDate
'            Else
'                !nDebit = rs!nAmount
'            End If
'        End With
'        rs.MoveNext
'    Loop
'    ComputeTotal
'    Set rs = Nothing
'
'    'dtbFrom.Text = Format(GetValueFrTable("dFrom", "PMS_EXPENSE", "cTranNo = '" & Trim(txtReference) & "'"), "mm/dd/yyyy")
'    'dtbTo.Text = Format(GetValueFrTable("dTo", "PMS_EXPENSE", "cTranNo = '" & Trim(txtReference) & "'"), "mm/dd/yyyy")
'    GetChild
'
'End Sub


Private Sub txtProject_Change()
    txtProjectName = ""
    txtProjectName = GetValueFrTable("cProjectName", "Project_Maintenance", "cProjectNo = '" & Trim(txtProject) & "'")
End Sub


Private Sub txtProject_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtProject) = "" And Trim(txtProject) <> "" Then cmdPickProject_Click
End Sub

Private Sub cmdPickProject_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtProject)
    frmITGPicker.zType = QProject
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
    
    frmITGPicker.Show vbModal
    txtProject = frmITGPicker.zCode
    txtProjectName = frmITGPicker.zName
    If Trim(txtProjectName) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub txtWork_Change()
    txtWorkDesc = ""
    If txtProject.Text = "" Then: txtProject.SetFocus: Exit Sub
    txtWorkDesc = GetValueFrTable("description", "Work_Maintenance_File", "workno = '" & Trim(txtWork) & "' ") 'and cProjectNo =  '" & Trim(txtProject) & "'")
End Sub


Private Sub cmdPickWork_Click()
    If lPickListActive Then Exit Sub
'    sFilterString = Trim(txtWork)
    frmITGPicker.zType = QWork
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "' and cProjectNo = '" & Trim(txtProject) & "'"
    
    frmITGPicker.Show vbModal
    txtWork = frmITGPicker.zCode
    txtWorkDesc = frmITGPicker.zName
    If Trim(txtWorkDesc) <> "" Then SendKeys "{Tab}"
End Sub


Private Sub txtWork_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtWork) = "" And Trim(txtWork) <> "" Then cmdPickWork_Click
End Sub

Public Sub TBAccountAffected()
    RepName = "GL"
    frmAccountAffected.mModuleType = KGL
    frmAccountAffected.mRefPK = txtTranNo.Text
    frmAccountAffected.Show vbModal
End Sub
